package groovy.runtime.metaclass.com.webobjects.foundation;

import java.util.Map;
import com.webobjects.foundation.NSDictionary;
import groovy.lang.*;

public class NSDictionaryMetaClass extends DelegatingMetaClass {

	public NSDictionaryMetaClass(MetaClass delegate) {
		super(delegate);
	}
	
	public Object invokeConstructor(Object[] arguments) {
		if (arguments==null)
			return super.invokeConstructor(arguments);
		if (arguments.length == 1) {
			Object arg = arguments[0];
			if (arg instanceof Map) {
				NSDictionary dict = new NSDictionary((Map)arg, true);
				arguments = new Object[] {dict};
			}
		}
		return super.invokeConstructor(arguments);
	}

}
